﻿using System;
using System.Collections.Generic;
using System.Text;

using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;

namespace Timer
{
	[Activity (Label = "Config", Icon = "@drawable/icon", ScreenOrientation = ScreenOrientation.Portrait)]			
	public class Config : Activity
	{
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Create your application here
			SetContentView (Resource.Layout.Config);
			Button btnVolver = FindViewById<Button> (Resource.Id.btnVolver);
			btnVolver.Click += (object sender, EventArgs e) => { Volver(sender, e); };
		}

		private void Volver(object sender, EventArgs e)
		{
			ToggleButton tglWifi = FindViewById<ToggleButton> (Resource.Id.tglWifi);
			ToggleButton tglWSSync = FindViewById<ToggleButton> (Resource.Id.tglWSSync);
			EditText txtURL = FindViewById<EditText> (Resource.Id.txtURL);

			var MainActivity = new Intent (this, typeof(MainActivity));
			MainActivity.PutExtra ("bWifi", tglWifi.Checked.ToString().ToLower());
			MainActivity.PutExtra ("bWSSync", tglWSSync.Checked.ToString().ToLower());
			MainActivity.PutExtra ("cURL", txtURL.Text);
			StartActivity (MainActivity);
		}
	}
}

